import common from './common'
import develop from './develop'
import release from './release'

const envs = { develop, release }

function _checkEnv (env) {
  if (!env) {
    return false
  }
  const envsKey = Object.keys(envs)
  if (envsKey.indexOf(env) !== -1) {
    return env
  } else {
    return false
  }
}

function getConfig (env) {
  const targetEnv = _checkEnv(env)
  const extraConfig = targetEnv ? envs[targetEnv] : null
  return {
    ...common,
    ...extraConfig
  }
}

export {
  getConfig
}